//
//  JXMallHeaderCell.m
//

#import "JXMallHeaderCell.h"

@interface JXMallHeaderCell ()

@property(nonatomic, strong) UIImage *backgroundImage;

@end

@implementation JXMallHeaderCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier
              backgroundImage:(UIImage *)image {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundImage = image;
    }
    return self;
}

- (UIImageView *)backgroundImageView {
    if (!_backgroundImageView) {
        _backgroundImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_backgroundImageView];
    }
    return _backgroundImageView;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.backgroundImageView.frame =
            CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    self.backgroundImageView.image = self.backgroundImage;
}

@end
